<?PHP $this->_extends('_layouts/manager_layout');?>
<?PHP $this->_block('head');?>
<?PHP $this->_endblock();?>
<?PHP $this->_block('contents');?>


<h2><?php if (!empty($goods->goods_id)):?>修改商品 <?php else:?> 添加商品 <?php endif;?></h2>

<form action="" method="post" enctype="multipart/form-data">
<table	width="90%" class="ebay_table">
	<tr><th width="150">商品编号:</th><td><input type="text" size=20 name="sn" value="<?php echo $goods->sn?>"></td><td>(商品的名字)</td></tr>
	<tr><th width="150">分类:</th><td>
		<select id='category_id' name='category_id' >
			<?php foreach($categories as $c):?>
				<?php if(count($c['children'])):?>
				<optgroup LABEL="<?=$c['name']?>"> 
					<?php foreach($c['children'] as $cc):?>
						<option value="<?=$cc['category_id']?>" ><?=$cc['name']?></option>
					<?php endforeach;?>
				</optgroup>
				<?php else:?>
				<option value="<?=$c['category_id']?>"><?=$c['name']?></option>
				<?php endif;?>
			<?php endforeach;?>
		</select>
	</td><td>()</td></tr>
	<tr><th width="150">标签:</th><td>
		<div class="pa">
		<?php if(count($Taggoods)): foreach($Taggoods as $tg):?>
    	<div style=" display:inline"><input type="checkbox" name="tag_id[]" value="<?=$tg->tag_id?>" <?php if(in_array($tg->tag_id,$goods->tag_ids)):?> checked="checked"<?php endif;?> /> <?=$tg->tag_name?> </div>
		<?php endforeach; endif;?>
	</div>
	</td><td>()</td></tr>
	<tr><th>主题图片:</th><td><img src="<?php if($goods->imgurl){echo $goods->imgurl;}?>" width="50" height="50" >	
		<input name="img" type="file" style="width:200;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff" size="30"> <br />
		
		</td><td>
	允许上传的文件类型为: <br > jpg|png|gif <br >(图片请保持小于200K)
		</td></tr>
	<tr><th> 使用图片地址:</th>
		<td>  <input type="checkbox" name="imgurl_using"   value="1" <?php if($goods->imgurl_using){echo 'checked="true"';}?> />
		 <input type="text" name="imgurl"  value="<?=$goods->imgurl?>" size="50"> </td><td>(商品的主题图片地址)</td>
	</tr>
	<tr><th>Market  price:</th><td><input type="text" size=40 name="market_price" value="<?php echo $goods->market_price?>"></td><td>()</td></tr>
	
	<tr><th>价格:</th><td><input type="text" size=40 name="price" value="<?php echo $goods->price?>"></td><td>()</td></tr>
	<tr><th>货币单位 :</th><td> 
		 <?php Q::control('dropdownlist','currency',array(
        "items"=>Helper_Array::toHashmap(Store_Currencies::all()->toArray(),'code','code'),
        'value'=>$goods->currency
    ))->display()?>
	 </td><td>()</td></tr>
	<tr><th>重量:</th><td><input type="text" size=40 name="weight" value="<?php echo $goods->weight?>"></td><td>(商品的重量，用来为计算国际邮费做参考,单位：G)</td></tr>
	<tr><th>库存:</th><td colspan="2">
		<?php if(empty($goods->goods_id)):?>
		<input type="text" size=4 name="addstock" value="0" title="填写库存">
		<?php else:?>
		<div>
		添加库存:+<input type="text" size=4 name="addstock" value="0" title="填写需添加库存">   &nbsp;&nbsp;
		实际库存:<span title="实际库存" style=" font-weight:bold;padding:0 20px;" id="v_stock"><?php echo $goods->stock?></span>  
		
		 </div>
		<?php endif;?>
		</td></tr>
		<tr><td colspan="3">  </td></tr>
		<?php foreach(Store_Language::all($store['store_id']) as $tmp_l): 
		$language=$tmp_l->language;
		?>
		<tr><th>(<?=$language?>)  商品名:</th><td><input type="text" size=40 name="title[<?=$language?>]" value="<?php echo @$goodslangdesc[$language]['title']?>"></td><td>(商品的名字)</td></tr>
		<tr><th>(<?=$language?>)属性:</th><td>
		<textarea name="property[<?=$language?>]" rows="5" cols="60"><?=@Helper_Csv_Implodegoods::combinationprops($goodslangdesc[$language]['property'])?></textarea>
		</td><td>(属性  如: <br />
		propCode_propName: code1_value1| code2_value2; ... 
		  )</td></tr>
		<tr><th>(<?=$language?>)简介:</th><td colspan="2">
			<textarea name="introduction[<?=$language?>]" rows="5" cols="60"><?=@$goodslangdesc[$language]['introduction']?></textarea>
		</td></tr>
		<tr><th>(<?=$language?>)描述:</th><td colspan="2">
			<textarea name="desc[<?=$language?>]" rows="5" cols="60"><?=@$goodslangdesc[$language]['desc']?></textarea>
			<?php //Q::control('wysiwyg','desc',array('value'=>$goods->desc,'style'=>'height:300px;width:700px;'))->display()?>
		</td></tr>
		
		<?php endforeach;?>

	<tr><th></th>
	<td></td>
</table> 

<div>
	<input type="hidden" name="goods_id" value="<?=$goods->goods_id?>"  />
	<input type="submit" value="   <?php if(!empty($goods->goods_id)){echo '确定修改';}else{echo '确定添加';}?>   " classs="anniu"> 
	&nbsp;&nbsp;
	<input type="button" value="       返回       "  onclick="location.replace('<?=url('storemanager/goods')?>')" classs="anniu"/>
</div>
</form>
</div>
<?PHP $this->_endblock();?>

